| Conditions | 3 | 
| Total Lines | 14 | 
| Code Lines | 12 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | import {CommandHandler} from '@nestjs/cqrs'; | 
            ||
| 15 | |||
| 16 |   public async execute(command: DeleteEventCommand): Promise<void> { | 
            ||
| 17 |     const {id, user} = command; | 
            ||
| 18 | const event = await this.eventRepository.findOneById(id);  | 
            ||
| 19 | |||
| 20 |     if (!(event instanceof Event)) { | 
            ||
| 21 | throw new EventNotFoundException();  | 
            ||
| 22 | }  | 
            ||
| 23 | |||
| 24 |     if (event.getUser().getId() !== user.getId()) { | 
            ||
| 25 | throw new NotEventOwnerException();  | 
            ||
| 26 | }  | 
            ||
| 27 | |||
| 28 | this.eventRepository.delete(event);  | 
            ||
| 29 | }  | 
            ||
| 31 |